package cn.cc.sort;

import java.rmi.ServerError;
import java.sql.SQLOutput;
import java.util.*;

public class TestException {
    public static void main(String[] args) {
        try{
            myException0();
            System.err.println(myException1());
        }catch (Exception e){
            try{
                System.err.println(myException3());
            }catch (Exception e1){
                System.err.println(e1.getMessage());
            }
        }
    }
    public static void myException0(){
        System.out.println("0");
    }
    public static String myException1() throws Exception{
        try{
            int i = 1/0 ;//这里产生了异常，但是进行了try catch处理
            System.err.println("1");
        }catch (Exception e){
            return "len1";
        }
        return "len0";
    }
    public static void myException2(){
        int i =1/0 ;
        System.err.println("2");
    }
    public static String myException3() throws Exception{
        try{
            int i = 1/0;
            System.out.println("3");
        }catch (Exception e){
            throw new Exception("throw new Exception");
        }
        return "len3";
    }
}
